/**
 * 
 */
package com.dalonedrow.rpg.base.flyweights;

/**
 * @author Donald
 */
public class ScriptTimer<IO> {
	/** the script associated with the timer. */
	private Scriptable<IO>	es;
	/** flag indicating whether the timer exists. */
	private boolean			exists;
	private int				flags;
	private IO				io;
	private long			longinfo;
	private long			msecs;
	private String			name;
	private int				namelength;
	private int			pos;
	private long			tim;
	private long			times;
	/**
	 * Adds a flag.
	 * @param flag the flag
	 */
	public void addFlag(final long flag) {
		flags |= flag;
	}
	/** Clears all flags that were set. */
	public void clearFlags() {
		flags = 0;
	}
	/**
	 * Gets the exists
	 * @return {@link boolean}
	 */
	public boolean exists() {
		return exists;
	}
	/**
	 * Gets the es
	 * @return {@link Scriptable<IO>}
	 */
	public Scriptable<IO> getEs() {
		return es;
	}
	/**
	 * Gets the io
	 * @return {@link IO}
	 */
	public IO getIo() {
		return io;
	}
	/**
	 * Gets the longinfo
	 * @return {@link long}
	 */
	public long getLonginfo() {
		return longinfo;
	}
	/**
	 * Gets the msecs
	 * @return {@link long}
	 */
	public long getMsecs() {
		return msecs;
	}
	/**
	 * Gets the name
	 * @return {@link String}
	 */
	public String getName() {
		return name;
	}
	/**
	 * Gets the namelength
	 * @return {@link int}
	 */
	public int getNamelength() {
		return namelength;
	}
	/**
	 * Gets the pos
	 * @return {@link long}
	 */
	public int getPos() {
		return pos;
	}
	/**
	 * Gets the tim
	 * @return {@link long}
	 */
	public long getTim() {
		return tim;
	}
	/**
	 * Gets the times
	 * @return {@link long}
	 */
	public long getTimes() {
		return times;
	}
	/**
	 * Determines if the {@link ScriptTimer} has a specific flag.
	 * @param flag the flag
	 * @return true if the {@link ScriptTimer} has the flag; false otherwise
	 */
	public final boolean hasFlag(final long flag) {
		return (flags & flag) == flag;
	}
	/**
	 * Removes a flag.
	 * @param flag the flag
	 */
	public void removeFlag(final long flag) {
		flags &= ~flag;
	}
	/**
	 * Sets the es
	 * @param es the es to set
	 */
	public void setEs(Scriptable<IO> es) {
		this.es = es;
	}
	/**
	 * Sets the exists
	 * @param exists the exists to set
	 */
	public void setExists(boolean exists) {
		this.exists = exists;
	}
	/**
	 * Sets the io
	 * @param io the io to set
	 */
	public void setIo(IO io) {
		this.io = io;
	}
	/**
	 * Sets the longinfo
	 * @param longinfo the longinfo to set
	 */
	public void setLonginfo(long longinfo) {
		this.longinfo = longinfo;
	}
	/**
	 * Sets the msecs
	 * @param msecs the msecs to set
	 */
	public void setMsecs(long msecs) {
		this.msecs = msecs;
	}
	/**
	 * Sets the name
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * Sets the namelength
	 * @param namelength the namelength to set
	 */
	public void setNamelength(int namelength) {
		this.namelength = namelength;
	}
	/**
	 * Sets the pos
	 * @param pos the pos to set
	 */
	public void setPos(int pos) {
		this.pos = pos;
	}
	/**
	 * Sets the tim
	 * @param tim the tim to set
	 */
	public void setTim(long tim) {
		this.tim = tim;
	}
	/**
	 * Sets the times
	 * @param times the times to set
	 */
	public void setTimes(long times) {
		this.times = times;
	}
}
